﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PatientMedical.ascx.cs"
    Inherits="Management_Nurse_PatientMedical" %>
<%@ Register Src="../../DatePicker.ascx" TagName="DatePicker" TagPrefix="uc1" %>
<%@ Register Src="../DanhSachThuoc.ascx" TagName="DanhSachThuoc" TagPrefix="uc2" %>
<style type="text/css">
    .tbCell
    {
        height:30px;
        text-align:left;
        font-size:16px;
        color:Black;
    }
    .tbHeader
    {
        height:40px;
        text-align:left;
        font-size:20px;
        color:White;
    }    
</style>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table class="style1">
    <tr>
        <td colspan="2" style="text-align: center; color: #009944; font-size: 20px">
            Thông tin chi tiết về Bệnh Nhân
        </td>
    </tr>
    <tr>
        <td colspan="2" class="style8">
            &nbsp;
        </td>
    </tr>
    <tr>
        <td class="style11">
            Mã số Bệnh nhân:
        </td>
        <td class="style10">
            <asp:TextBox ID="tbID" runat="server" Height="23px" Width="185px" 
                ReadOnly="True"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="style11">
            &nbsp;Mã số giường:
        </td>
        <td>
            <asp:TextBox ID="tbIDBed" runat="server" Height="27px" Width="184px" 
                ReadOnly="True"></asp:TextBox>
            &nbsp;
        </td>
    </tr>
    <tr>
        <td class="style11">
            Họ và tên:
        </td>
        <td>
            <asp:TextBox ID="tbName" runat="server" Height="27px" Width="185px" 
                ReadOnly="True"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="style11">
            &nbsp;
        </td>
        <td class="style10">
            &nbsp;
        </td>
    </tr>
    <tr>
        <td class="style11">
            Ngày sinh:
        </td>
        <td class="style10">
            <asp:TextBox ID="tbDob" runat="server" Height="19px" Width="105px" ReadOnly="True"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="style11">
            Giới tính:
        </td>
        <td>
            <asp:TextBox ID="tbGender" runat="server" Height="19px" Width="105px" ReadOnly="True"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="style11">
            Địa chỉ:
        </td>
        <td>
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        </td>
    </tr>
    <tr>
        <td class="style7" colspan="2" style="color: #009944; font-size: 20px">
            &nbsp;
        </td>
    </tr>
    <tr>
        <td class="style7" colspan="2" style="color: #009944; font-size: 20px">
            Thuốc sử dụng:
        </td>
    </tr>
    <tr>
        <td class="style7" colspan="2">
            <asp:Panel runat="server" ID="pnThemThuoc" Style="overflow: auto" ScrollBars="Vertical"
                Height="241px" Width="589px">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" HorizontalAlign="Center"
                    Width="547px"
                    CellPadding="4" DataKeyNames="ID" DataSourceID="thuocDS" 
                    ForeColor="#333333" GridLines="None">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:TemplateField HeaderText="Tên thuốc" SortExpression="Name">                            
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle CssClass="tbCell" />
                            <HeaderStyle CssClass="tbHeader" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Liều dùng/ngày" SortExpression="UnitPerDay">                            
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("UnitPerDay") %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle CssClass="tbCell" />
                            <HeaderStyle CssClass="tbHeader" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày bắt đầu" SortExpression="StartDate">                            
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" 
                                    Text='<%# Bind("StartDate", "{0: dd/MM/yyyy}") %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle CssClass="tbCell" />
                            <HeaderStyle CssClass="tbHeader" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày kết thúc" SortExpression="FinishDate">                            
                            <ItemTemplate>
                                <asp:Label ID="Label4" runat="server" 
                                    Text='<%# Bind("FinishDate", "{0: dd/MM/yyyy}") %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle CssClass="tbCell" />
                            <HeaderStyle CssClass="tbHeader" />
                        </asp:TemplateField>
                    </Columns>
                    <EditRowStyle BackColor="#7C6F57" />
                    <FooterStyle BackColor="#1C5E55" ForeColor="White" Font-Bold="True" />
                    <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#E3EAEB" />
                    <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#F8FAFA" />
                    <SortedAscendingHeaderStyle BackColor="#246B61" />
                    <SortedDescendingCellStyle BackColor="#D4DFE1" />
                    <SortedDescendingHeaderStyle BackColor="#15524A" />
                </asp:GridView>
                <asp:SqlDataSource ID="thuocDS" runat="server" ConnectionString="<%$ ConnectionStrings:HOSPITALMANAGEMENTConnectionString %>"
                    DeleteCommand="DELETE FROM [tbUseDrug] WHERE [ID] = @ID" InsertCommand="INSERT INTO [tbUseDrug] ([IDDrug], [UnitPerDay], [StartDate], [FinishDate]) VALUES (@IDDrug, @UnitPerDay, @StartDate, @FinishDate)"
                    SelectCommand="SELECT tbDrug.[Name], [UnitPerDay], [StartDate], [UseMethod], [FinishDate], tbUseDrug.[ID] FROM [tbUseDrug] INNER JOIN [tbDrug] ON tbUseDrug.IDDrug=tbDrug.ID WHERE (([IDPatient] = @IDPatient) AND ([IDAppointment] = @IDAppointment)) ORDER BY [StartDate]"
                    UpdateCommand="UPDATE [tbUseDrug] SET [IDDrug] = @IDDrug, [UnitPerDay] = @UnitPerDay, [StartDate] = @StartDate, [FinishDate] = @FinishDate WHERE [ID] = @ID">
                    <DeleteParameters>
                        <asp:Parameter Name="ID" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="IDDrug" Type="Int32" />
                        <asp:Parameter Name="UnitPerDay" Type="Int32" />
                        <asp:Parameter DbType="Date" Name="StartDate" />
                        <asp:Parameter DbType="Date" Name="FinishDate" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:FormParameter FormField="IDPatient" Name="IDPatient" Type="Int32" />
                        <asp:FormParameter FormField="IDAppointment" Name="IDAppointment" Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="IDDrug" Type="Int32" />
                        <asp:Parameter Name="UnitPerDay" Type="Int32" />
                        <asp:Parameter DbType="Date" Name="StartDate" />
                        <asp:Parameter DbType="Date" Name="FinishDate" />
                        <asp:Parameter Name="ID" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </asp:Panel>
        </td>
    </tr>
    <tr>
        <td class="style7" colspan="2" style="color: #0000FF; font-size: 20px">
            Thêm thuốc sử dụng:
        </td>
    </tr>
    <tr>
        <td class="style11" style="color: #008000; font-size: medium; font-style: normal">
            Mã khoa:
        </td>
        <td class="style10" style="font-family: 'Times New Roman', Times, serif; font-size: medium;
            color: #000000">
            <asp:Label ID="lbWard" runat="server" Text="Label"></asp:Label>
        </td>
    </tr>
    <tr>
        <td class="style12" style="color: #008000; font-size: medium; font-style: normal">
            Tên thuốc:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </td>
        Tên thuốc:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        <td class="style8">
            <uc2:DanhSachThuoc ID="DanhSachThuoc1" runat="server" />
        </td>
    </tr>
    <tr>
        <td class="style13" style="color: #008000; font-size: medium; font-style: normal">
            Liều dùng mỗi ngày:
        </td>
        <td class="style14" style="font-family: 'Times New Roman', Times, serif; font-size: medium;
            color: #000000">
            <asp:TextBox ID="tbUnitbyDay" runat="server" Height="19px" Width="176px">0</asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="style11">
            &nbsp;
        </td>
        <td class="style10">
            &nbsp;
        </td>
    </tr>
    <tr>
        <td class="style11" style="color: #008000; font-size: medium; font-style: normal">
            Ngày bắt đầu:
        </td>
        <td class="style10">
            <uc1:DatePicker ID="dateStart" runat="server" />
        </td>
    </tr>
    <tr>
        <td class="style12" style="color: #008000; font-size: medium; font-style: normal">
            Ngày kết thúc:
        </td>
        <td class="style8">
            <uc1:DatePicker ID="dateEnd" runat="server" />
        </td>
    </tr>
    <tr>
        <td class="style11" style="color: #008000; font-size: medium; font-style: normal">
            &nbsp;
        </td>
        <td class="style10">
            &nbsp;
        </td>
    </tr>
    <tr>
        <td class="style11" style="color: #008000; font-size: medium; font-style: normal">
            &nbsp;
        </td>
        <td class="style10">
            &nbsp;
            <asp:Button ID="Button1" runat="server" ForeColor="Blue" Text="Thêm thuốc sử dụng"
                OnClick="Button1_Click" />
        </td>
    </tr>
</table>
